package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLd8;
import com.huizu.project.service.IProLd8Service;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 劳动执行/文明宿舍Controller
 * 
 * @author zhangmx
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/project/prold8")
public class ProLd8Controller extends BaseController
{
    @Autowired
    private IProLd8Service proLd8Service;

    /**
     * 查询劳动执行/文明宿舍列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold8:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLd8 proLd8)
    {
        startPage();
        List<ProLd8> list = proLd8Service.selectProLd8List(proLd8);
        return getDataTable(list);
    }

    /**
     * 导出劳动执行/文明宿舍列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold8:export')")
    @Log(title = "劳动执行/文明宿舍", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLd8 proLd8)
    {
        List<ProLd8> list = proLd8Service.selectProLd8List(proLd8);
        ExcelUtil<ProLd8> util = new ExcelUtil<ProLd8>(ProLd8.class);
        util.exportExcel(response, list, "劳动执行/文明宿舍数据");
    }

    /**
     * 获取劳动执行/文明宿舍详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prold8:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proLd8Service.selectProLd8ById(id));
    }

    /**
     * 新增劳动执行/文明宿舍
     */
    @PreAuthorize("@ss.hasPermi('project:prold8:add')")
    @Log(title = "劳动执行/文明宿舍", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLd8 proLd8)
    {
        return toAjax(proLd8Service.insertProLd8(proLd8));
    }

    /**
     * 修改劳动执行/文明宿舍
     */
    @PreAuthorize("@ss.hasPermi('project:prold8:edit')")
    @Log(title = "劳动执行/文明宿舍", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLd8 proLd8)
    {
        return toAjax(proLd8Service.updateProLd8(proLd8));
    }

    /**
     * 删除劳动执行/文明宿舍
     */
    @PreAuthorize("@ss.hasPermi('project:prold8:remove')")
    @Log(title = "劳动执行/文明宿舍", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proLd8Service.deleteProLd8ByIds(ids));
    }
}
